import { __ON_LINK__ } from "@/common";
import { Toast } from "antd-mobile";
import { ExclamationTriangleOutline } from "antd-mobile-icons";
import React from "react";
import { ChatMessageType, RenderItem } from "../../../../serve/interfaces";

export default (props: RenderItem<ChatMessageType.LINK>) => {
  const { body } = props
  return <a href={body} target="_blank" onClick={e => {
    __ON_LINK__?.(body, false, (content) => Toast.show({
      icon: <ExclamationTriangleOutline />,
      content,
    }))(e.nativeEvent)
  }}>{body}</a>
}
